package com.lxyk.sgq.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lxyk.sgq.dao.OrderDao;
import com.lxyk.sgq.entity.Order;
import com.lxyk.sgq.utils.AjaxResult;

import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

@DubboService
public class OrderServiceImpl  extends ServiceImpl<OrderDao, Order> implements  IOrderService{

    @Autowired
    private OrderDao orderDao;

    @Override
    public AjaxResult addOrder(Integer goodsId) {
        Order order = new Order();
        order.setGoodsId(goodsId);

        int count = orderDao.insert(order);
        return count == 1 ? AjaxResult.success("下单成功"):AjaxResult.success("下单失败");
    }
}
